<ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:f="http://java.sun.com/jsf/core" xmlns:p="http://primefaces.org/ui">
	<p:messages autoUpdate="true" />
	<h:form>
		<p:dataList id="existingLoanDebts" value="#{customerMaintBean.loanApplication.existingLoanDebts}" var="existingLoanDebt" type="definition" emptyMessage="Nincs jövedelem rögzítve">
			<p:fieldset legend="Fennálló kölcsöntartozás">
				<p:dialog widgetVar="dialog" showEffect="fade" hideEffect="fade">
					<h:panelGrid id="loanApplicationDisplay" columns="2" cellpadding="5">
						<h:outputText value="#{existingLoanDebt.loanExpiration}">
							<f:convertDateTime pattern="yyyy/MM/dd" />
						</h:outputText>
					</h:panelGrid>
				</p:dialog>
				<h:panelGrid columns="3">
					<p:outputLabel for="currency" value="Kölcsöntartozás pénzneme" />
					<p:selectOneMenu id="currency" required="true" value="#{existingLoanDebt.currency}">
						<f:selectItem itemLabel="Kérem válasszon!" itemValue="" />
						<f:selectItems value="#{mainData.currencies}" />
					</p:selectOneMenu>
					<p:message for="currency" />

					<p:outputLabel for="existingLoanDebtAmount" value="Fennálló kölcsöntartozás összege" />
					<p:inputText id="existingLoanDebtAmount" required="true" value="#{existingLoanDebt.existingLoanDebtAmount}" />
					<p:message for="existingLoanDebtAmount" />

					<p:outputLabel for="monthlyInstallment" value="Havi törlesztőrészlet" />
					<p:inputText id="monthlyInstallment" required="true" value="#{existingLoanDebt.monthlyInstallment}" />
					<p:message for="monthlyInstallment" />

					<h:outputLabel for="loanExpiration" value="Kölcsöntartozás lejárata" />
					<p:calendar id="loanExpiration" required="true" value="#{existingLoanDebt.loanExpiration}" mindate="#{currentDate}" showOn="button"/>
					<p:message for="loanExpiration" />
				</h:panelGrid>
			</p:fieldset>
		</p:dataList>
		<h:panelGrid columns="2">
			<p:commandButton process="@form" value="Új kölcsöntartozás felvétele" action="#{customerMaintBean.addExistingLoanDebt()}" update="existingLoanDebts" disabled="#{customerMaintBean.loanApplication.status gt 2}"></p:commandButton>
			<p:commandButton process="@form" value="Mentés" disabled="#{customerMaintBean.loanApplication.status gt 2}" />
			<p:commandButton process="@form" value="Törlés" action="#{customerMaintBean.deleteExistingLoanDebt()}" update="existingLoanDebts" disabled="#{customerMaintBean.loanApplication.status gt 2}"></p:commandButton>
			<p:inputText id="delete" value="#{customerMaintBean.deleteExistingLoanDebtNumber}" />
			<p:message for="delete" />
		</h:panelGrid>
	</h:form>
</ui:composition>